{% spaceless %}
<form class="form-vertical" id="imt_event_form_general" action="{% if event.id %}{{ path('plugin_general_task_edit_ajax', {'idEvent': event.id}) }}{% else %}{{ path('plugin_general_task_edit_ajax', {'idEvent': 0}) }}{% endif %}" method="POST">

<div class="widget">
	<div class="widget-header">
		<span class="title"><i class="icos-clipboard-2 icos-white"></i>Tâche</span>
		<div class="toolbar">
			<span style="display:inline-block; padding:10px;" id="plug-general-loader"></span>
			<div class="btn-group" id="plug-general-actions">
				<span class="btn dropdown-toggle" data-toggle="dropdown">
						<i class="icon-pencil"></i> Actions <i class="caret"></i>
				</span>
				<ul class="dropdown-menu pull-right">
					<li><a href="{{ path('task_homepage', {'id':0}) }}"><i class="icol-add"></i> Nouvel événement</a></li>
					{% if is_granted('EDIT',event) %}
					<li><a href="#" id="plug-general-edit"><i class="icol-pencil"></i> Modifier l\'événement</a></li>
					{% endif %}
					{% if is_granted('DELETE',event) %}
					<li><a href="{{ path('event_delete', {'id':event.id}) }}" id="plug-general-delete"><i class="icol-cross"></i> Supprimer l\'événement</a></li>
					{% endif %}
				</ul>
			</div>			
		</div>
	</div>
	
	<div class="toolbar btn-toolbar form-edit" style="padding:0px;">
	    <div class="btn-group">
	    	<button id="plug-general-save" type="submit" class="btn"><i class="icol-accept"></i> Sauvegarder</button>
	    	<button id="plug-general-undo" class="btn" type="reset"><i class="icol-arrow-undo"></i> Rétablir</button>
	    	<button id="plug-general-cancel" type="button" class="btn"><i class="icol-cancel"></i> Annuler</button>
	  	</div>
	</div>
	
	<div class="widget-content table-container">   
		<table class="table table-striped table-detail-view">
			<thead>
				<tr>
					<th colspan="5"><i class="icol-exclamation"></i> Informations générales</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<th>Titre</th>
					<td colspan="4">
						<span class="form-view" id="imt_event_form_general_title_view">{{ form.vars.value.title|escape('js') }}</span>
						<span class="form-edit">{{ form_widget(form.title, {'attr':{'style':'width:90%'}}) }}</span>
					</td>
				</tr>
				<tr>
					<th style="width:20%;">Date de début</th>
					<td style="width:28%;">
						<span class="form-view" id="imt_event_form_general_date_date_view">{{ form.vars.value.date|date('d/m/Y') }}</span>
						<span class="form-edit">
							<span id="imt_event_form_general_date_date_edit">{{ form.vars.value.date|date('d/m/Y') }}</span>
							<input type="hidden" value="{{ form.vars.value.date|date('d/m/Y') }}" />
						</span>
					</td>
					<th style="width:20%; border:1px solid #CCC;">Heure de début</th>
					<td style="width:28%;">
						<span class="form-view" id="imt_event_form_general_date_time_view">{% if form.vars.value.allDay %}00:00{% else %}{{ form.vars.value.date|date('H:i') }}{% endif %}</span>
						<span class="form-edit">
							<span id="imt_event_form_general_date_time_edit">{% if form.vars.value.allDay %}00:00{% else %}{{ form.vars.value.date|date('H:i') }}{% endif %}</span>
							<input type="hidden" value="{% if form.vars.value.allDay %}00:00{% else %}{{ form.vars.value.date|date('H:i') }}{% endif %}" />
						</span>
					</td>
					<td>
						<input type="text" value="{{ form.vars.value.date|date('Y-m-d H:i:s') }}" class=" not-removable" style="display:none;" required="required" name="imt_event_form_general[date]" id="imt_event_form_general_date">
						<button id="plug-general-date-edit" class="btn btn-mini pull-right form-edit" type="button">
			            	<i class="icol-calendar-2"></i>
			            </button>	
					</td>
				</tr>
				<tr>
					<th>Date de fin</th>
					<td>
						<span class="form-view" id="imt_event_form_general_dateFin_date_view">{{ form.vars.value.dateFin|date('d/m/Y') }}</span>
						<span class="form-edit">
							<span id="imt_event_form_general_dateFin_date_edit">{{ form.vars.value.dateFin|date('d/m/Y') }}</span>
							<input type="hidden" value="{{ form.vars.value.dateFin|date('d/m/Y') }}" />
						</span>
					</td>
					<th style="border:1px solid #CCC;">Heure de fin</th>
					<td>
						<span class="form-view" id="imt_event_form_general_dateFin_time_view">{% if form.vars.value.allDay %}00:00{% else %}{{ form.vars.value.dateFin|date('H:i') }}{% endif %}</span>
						<span class="form-edit">
							<span id="imt_event_form_general_dateFin_time_edit">{% if form.vars.value.allDay %}00:00{% else %}{{ form.vars.value.dateFin|date('H:i') }}{% endif %}</span>
							<input type="hidden" value="{% if form.vars.value.allDay %}00:00{% else %}{{ form.vars.value.dateFin|date('H:i') }}{% endif %}" />
						</span>
					</td>
					<td>
						<input type="text" value="{{ form.vars.value.dateFin|date('Y-m-d H:i:s') }}" class=" not-removable" style="display:none;" required="required" name="imt_event_form_general[dateFin]" id="imt_event_form_general_dateFin">
						<button id="plug-general-dateFin-edit" class="btn btn-mini pull-right form-edit" type="button">
			            	<i class="icol-calendar-2"></i>
			            </button>	
					</td>
				</tr>
				<tr>
					<th>Toute la journée</th>
					<td colspan="4">
						<span class="form-view" id="imt_event_form_general_allDay_view">{% if form.vars.value.allDay %}<span class="badge badge-success">Oui</span>{% else %}<span class="badge">Non</span>{% endif %}</span>
						<span class="form-edit">{{ form_widget(form.allDay) }}</span>					
					</td>
{# 					<th style="border: 1px solid #CCC;">Récurrence</th>#}
{# 					<td colspan="2">#}
{# 						<span>Aucune</span>#}
{# 						<button class="btn btn-mini pull-right form-edit" type="button">#}
{# 			            	<i class="icol-cog"></i>#}
{# 			            </button>#}
{# 					</td>#}
				</tr>
			</tbody>
			<thead>
				<tr>
					<th colspan="5"><i class="icol-find"></i> Détails complémentaires</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<th>Description</th>
					<td colspan="4">
						<span class="form-view" id="imt_event_form_general_content_view">{{ form.vars.value.content|escape('js') }}</span>
						<span class="form-edit">{{ form_widget(form.content, {'attr':{'style':'width:90%'}}) }}</span>
					</td>
				</tr>
				{% for owner in event.owners %}
					{% if app.user.id == owner.id %}
				<tr>
					<th>Compte</th>
					<td colspan="4">
						<span class="form-edit">
							<select id="imt_event_form_general_account" name="imt_event_form_general_account">
							{% for account in accounts %}
								<option value="{{ account.id }}" {% for event_account in event.accounts %}{% if event_account.id == account.id %}selected="selected"{% endif %}{% endfor %}>{{ account.title }}</option>
							{% endfor %}
							</select>
						</span>
						<span class="form-view" id="imt_event_form_general_content_view">{% for account in accounts %}{% for event_account in event.accounts %}{% if event_account.id == account.id %}{{ account.title }} {% endif %}{% endfor %}{% endfor %}</span>
					</td>
				</tr>
					{% endif %}
				{% else %}
				<tr>
					<th>Compte</th>
					<td colspan="4">
						<span class="form-edit">
							<select id="imt_event_form_general_account" name="imt_event_form_general_account">
							{% for account in accounts %}
								<option value="{{ account.id }}" {% for event_account in event.accounts %}{% if event_account.id == account.id %}selected="selected"{% endif %}{% endfor %}>{{ account.title }}</option>
							{% endfor %}
							</select>
						</span>
						<span class="form-view" id="imt_event_form_general_content_view">{% for account in accounts %}{% for event_account in event.accounts %}{% if event_account.id == account.id %}{{ account.title }} {% endif %}{% endfor %}{% endfor %}</span>
					</td>
				</tr>
				{% endfor %}
			</tbody>
		</table>
	</div>
</div>
</form>

<div id="modal-timepicker" title="Changer une date">
    <div id="plug-general-datetime-picker"></div>
</div>
{% endspaceless %}